﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpCrack
{
	/// <summary>
	/// 
	/// </summary>
	public class PermutationEnumerator : IEnumerator<string>
	{
		public PermutationEnumerator(PermutationGenerator gen)
		{
			this.Generator = gen;
		}

		/// <summary>
		/// 
		/// </summary>
		public PermutationGenerator Generator { get; protected set; }

		/// <summary>
		/// 
		/// </summary>
		public string Current
		{
			get { return this.Generator.Current; }
		}

		public void Dispose()
		{
			GC.SuppressFinalize(this);
		}

		object System.Collections.IEnumerator.Current
		{
			get { return this.Current; }
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public bool MoveNext()
		{
			this.Generator.AdvanceCursor();
			return this.Generator.NormalizeCursor();
		}

		/// <summary>
		/// 
		/// </summary>
		public void Reset()
		{
			this.Generator.Reset();
		}
	}
}
